﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;

namespace Zzcore.Model
{
    [Table(Name = "permission")]
    public class Permission
    {
        [Column(IsIdentity = true, IsPrimary = true, Name = "id")]
        [JsonProperty("id")]
        public long Id { get; set; }

        [Column(Name = "name")]
        [JsonProperty("name")]
        public string Name { get; set; }

        [Column(Name = "type")]
        [JsonProperty("type")]
        [Description("菜单类型: menu、link、button、text")]
        public string Type { get; set; } = "menu";

        [Column(Name = "pid")]
        [JsonProperty("pid")]
        public long Pid { get; set; }

        [Column(Name = "icon")]
        [JsonProperty("icon")]
        public string Icon { get; set; }

        [Column(Name = "route")]
        [JsonProperty("route")]
        [Description("路由地址")]
        public string Route { get; set; }

        [Column(Name = "number")]
        [JsonProperty("number")]
        [Description("菜单编号")]
        public string Number { get; set; }

        [Column(Name = "code")]
        [JsonProperty("code")]
        [Description("编码")]
        public string Code { get; set; }

        [Column(Name = "tag")]
        [JsonProperty("tag")]
        [Description("TAG标签")]
        public string Tag { get; set; }

        [Column(Name = "sortid")]
        [JsonProperty("sortid")]
        [Description("排序ID")]
        public int Sortid { get; set; }

        [Column(Name = "hidden")]
        [JsonProperty("hidden")]
        [Description("是否隐藏: 0-隐藏 1-显示")]
        public int Hidden { get; set; } = 0;

        [Column(Name = "created", ServerTime = DateTimeKind.Local, CanUpdate = false, DbType = "datetime(0)")]
        [JsonProperty("created")]
        public DateTime CreateTime { get; set; }

        [Column(Name= "updated", ServerTime = DateTimeKind.Local, DbType = "datetime(0)")]
        [JsonProperty("updated")]
        public DateTime UpdateTime { get; set; }
    }
}
